﻿package com.findMoneyGame.pages.buyMoney {
	import com.findMoneyGame.models.User;
	import com.findMoneyGame.pages.DialogPage;

	import flash.events.MouseEvent;
	import flash.events.Event;
	
	public class BuyMoneyPage extends DialogPage {
		
		private function get user () : User { return User.getInst(); }

		public function BuyMoneyPage() {
			closeButton.addEventListener(MouseEvent.CLICK, closeBtnEventHandler);
			buy100coinsButton.addEventListener(MouseEvent.CLICK, function () { buyCoins(100); });
			buy50coinsButton.addEventListener(MouseEvent.CLICK, function () { buyCoins(50); });
			buy20coinsButton.addEventListener(MouseEvent.CLICK, function () { buyCoins(20); });
		}

		private function buy100coins (e : Event) {
			buyCoins(100);
			//
		}

		private function buyCoins (count : int) {
			user.buyMoney(count);
			//
		}
	}
	
}
